<?php if (!defined('THINK_PATH')) exit();?><!--_meta 作为公共模版分离出去-->
<!DOCTYPE HTML>
<html>
<head>
<title>新增中介公司</title>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />

<link rel="Bookmark" href="/favicon.ico" >
<link rel="Shortcut Icon" href="/favicon.ico" />
<!--[if lt IE 9]>
<script type="text/javascript" src="/Public/Admin/lib/html5.js"></script>
<script type="text/javascript" src="/Public/Admin/lib/respond.min.js"></script>
<script type="text/javascript" src="/Public/Admin/lib/PIE_IE678.js"></script>
<![endif]-->
<link rel="stylesheet" type="text/css" href="/Public/Admin/lib/static/h-ui/css/H-ui.min.css" />
<link rel="stylesheet" type="text/css" href="/Public/Admin/lib/static/h-ui.admin/css/H-ui.admin.css" />
<link rel="stylesheet" type="text/css" href="/Public/Admin/lib/Hui-iconfont/1.0.7/iconfont.css" />
<link rel="stylesheet" type="text/css" href="/Public/Admin/css/sty.css">
<!--[if IE 6]>
<script type="text/javascript" src="http://lib.h-ui.net/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<!--/meta 作为公共模版分离出去-->

<style type="text/css">
	.textarea{height: 150px}
	.wq5{margin-top: 10px;margin-bottom: 10px;}
	.textarea{height:200px;}
	.a_c{float: right;padding-right: 100px;padding-top: 20px;color: blue}
    .btn{font-size: 14px !important;height: 31px;}
	/*.tj1{text-align: center;}*/
</style>
</head>


<body>

    <div class="page-container">

    	<!--<div class="mt-20 wq5" style="margin:5px 0px;padding-bottom: 0px !important;padding-top: 12px !important">-->
    	<form class="form form-horizontal" >
            <div class="mt-15 wq5" style="margin:0px;">
                <div class="row cl">
        			<label class="form-label col-xs-3 col-sm-3" style="width:25% !important;line-height:2;padding:0px;">中介公司：</label>
        			<div class="formControls col-xs-8 col-sm-8 ">
        				<input type="text" id="company" name="company" class="input-text" >
        			</div>
        		</div>
            </div>
    
            <div class="text-c mt-20">
            	<button onClick="tj();" id="sub" class="btn btn-primary radius" type="button">&nbsp;&nbsp;新增&nbsp;&nbsp;</button>&nbsp;&nbsp;&nbsp;&nbsp;
            	<button onClick="layer_close();" class="btn btn-default radius" type="button">&nbsp;&nbsp;取消&nbsp;&nbsp;</button>
            </div>
        </form>
    </div>
	

	<!--_footer 作为公共模版分离出去-->
	<script type="text/javascript" src="/Public/Admin/lib/jquery/1.9.1/jquery.min.js"></script>
	<script type="text/javascript" src="/Public/Admin/lib/layer/2.1/layer.js"></script>
	<script type="text/javascript" src="/Public/Admin/lib/static/h-ui/js/H-ui.js"></script>
	<script type="text/javascript" src="/Public/Admin/lib/static/h-ui.admin/js/H-ui.admin.js"></script>
	<!--/请在下方写此页面业务相关的脚本-->
	<script type="text/javascript">
        // 添加
        function tj(){
            //$('form').submit();
            if( !$.trim($('#company').val()) ){
                layer.msg('请填写中介公司名称',{icon:2,time:1000});
            }else{
                $('#sub').attr('onclick','');  // 避免重复提交
                $.ajax({
                    url: "<?php echo U('Client/addCompanyCheck');?>",
                    type: "POST",
                    data: $('form').serializeArray(),
                    success: function(msg){
                        console.log(msg);
                        if(msg['state'] == 200){
                            parent.$('#company-select').val( $.trim($('#company').val()) );
                            parent.$('#company-input').val(msg['id']);
                            parent.$('#company-type').val('add');
                            layer.msg(msg['content'],{icon:1,time:1000});
                            setTimeout(layer_close(),1000);
                        }else{
                            layer.msg(msg['content'],{icon:2,time:1000});
                            $('#sub').attr('onclick','tj()');  // 添加出错，允许重新提交
                        }
                    }
                });
            }

        }


	</script>


</body>
</html>